import store from '@/store'
import { i18nRender } from '../../locales'

let columns

if (store.state.user.info.isAdmin) {
  columns = [
    {
      title: i18nRender('all.autotext1156'),
      key: 'applyNo',
      width: 100,
      // sorter: (a, b) => a.applyNo - b.applyNo,
      dataIndex: 'applyNo'
    },
    {
      title: i18nRender('all.autotext244'),
      key: 'createTime',
      width: 120,
      dataIndex: 'createTime',
      scopedSlots: { customRender: 'createTime' }
    },
    {
      title: i18nRender('all.autotext949'),
      key: 'orgNo',
      width: 120,
      customRender: (text, record) => (`${record.researchCenterNo} - ${record.orgName}`)
    },
    {
      title: i18nRender('all.autotext1236'),
      key: 'type',
      dataIndex: 'type',
      width: 120,
      scopedSlots: { customRender: 'type' }
    },
    {
      title: i18nRender('all.autotext1521'),
      key: 'createrId',
      width: 120,
      dataIndex: 'createrId'
    },
    {
      title: i18nRender('all.autotext597'),
      key: 'ptsNo',
      dataIndex: 'ptsNo',
      width: 120,
      scopedSlots: { customRender: 'ptsNo' }
    },
    {
      title: i18nRender('all.autotext867'),
      key: 'totalAmount',
      dataIndex: 'totalAmount',
      width: 120,
      customRender: (text, record) => (`${i18nRender('money.unit')}${record.totalAmount}`)
    },
    {
      title: i18nRender('all.autotext82'),
      key: 'payTime',
      dataIndex: 'payTime',
      width: 120,
      scopedSlots: { customRender: 'createTime' }
    },
    {
      title: i18nRender('all.autotext196'),
      key: 'payNo',
      width: 120,
      dataIndex: 'payNo'
    },
    {
      title: i18nRender('all.autotext187'),
      dataIndex: 'operation',
      width: 120,
      scopedSlots: { customRender: 'operation' }
    }
  ]
} else {
  columns = [
    {
      title: i18nRender('all.autotext1156'),
      key: 'applyNo',
      width: 120,
      // sorter: (a, b) => a.applyNo - b.applyNo,
      dataIndex: 'applyNo'
    },
    {
      title: i18nRender('all.autotext1158'),
      width: 100,
      key: 'status',
      dataIndex: 'status',
      scopedSlots: { customRender: 'status' }
    },
    {
      title: i18nRender('all.autotext244'),
      width: 200,
      key: 'createTime',
      dataIndex: 'createTime',
      scopedSlots: { customRender: 'createTime' }
    },
    {
      title: i18nRender('all.autotext949'),
      width: 200,
      key: 'orgNo',
      customRender: (text, record) => (`${record.researchCenterNo} - ${record.orgName}`)
    },
    {
      title: i18nRender('all.autotext1236'),
      key: 'type',
      width: 120,
      dataIndex: 'type',
      scopedSlots: { customRender: 'type' }
    },
    {
      title: i18nRender('all.autotext597'),
      key: 'ptsNo',
      width: 120,
      dataIndex: 'ptsNo',
      scopedSlots: { customRender: 'ptsNo' }
    },
    {
      title: i18nRender('all.autotext867'),
      key: 'totalAmount',
      width: 120,
      dataIndex: 'totalAmount',
      customRender: (text, record) => (`${i18nRender('money.unit')}${record.totalAmount}`)
    },
    {
      title: i18nRender('all.autotext550'),
      width: 400,
      key: 'applyReason',
      dataIndex: 'applyReason',
      scopedSlots: { customRender: 'applyReason' }
    },
    {
      title: i18nRender('all.autotext187'),
      dataIndex: 'operation',
      width: 120,
      scopedSlots: { customRender: 'operation' }
    }
  ]
}

export { columns }
